//
//  DKPublicHttp.m
//  DanKU
//
//  Created by 吴斌 on 2023/10/1.
//

#import "DKPublicHttp.h"
#import "DKUserRsdKeyModel.h"
#import "DKLoanSetpInfoModel.h"
@implementation DKPublicHttp
//获取user-service公钥
+(void)apiUserRsaKeyForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    WeakSelf(self)
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_UserRsaKey] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *userRsdKeDic = (NSDictionary *)[data objectForKey:@"data"];
        DKUserRsdKeyModel *dk_UserRsdKeyMdl = [DKUserRsdKeyModel mj_objectWithKeyValues:userRsdKeDic];
        [DKGlobalHelper defaultManager].userRsaKey = dk_UserRsdKeyMdl.key;
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        [weakSelf apiUserRsaKeyForAPI:param complete:complete];
    }];
}
//获取验证码次数
+(void)apiUserSendSmsCountForAPI:(NSDictionary *)param complete:(void(^)(NSString * codeCount))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_SendSMSCount] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSString *userCodeCount = [data objectForKey:@"data"];
        complete(userCodeCount);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//获取验证码次数
+(void)apiUserSendSmsForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_SendSMS] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//获取下一步认证信息
+(void)apiGetNextStepForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_GetNextStep] params:param withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        if([[data objectForKey:@"code"] isEqualToString:@"200"]){
            NSDictionary *nextStepDic = (NSDictionary *)[data objectForKey:@"data"];
            DKLoanSetpInfoModel *dk_LoanSetpInfoMdl = [DKLoanSetpInfoModel mj_objectWithKeyValues:nextStepDic];
            [DKGlobalHelper defaultManager].loanSetpInfoMdl = dk_LoanSetpInfoMdl;
        }
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//检查是否可以做OCR/活体
+(void)apiCheckIsCanAuthForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_CheckIsCanAuth] params:param withJson:NO withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        if([[data objectForKey:@"code"] isEqualToString:@"200"]){
            NSDictionary *checkResultDic = (NSDictionary *)[data objectForKey:@"data"];
            BOOL checkResult = [checkResultDic objectForKey:@"checkResult"];
            if(checkResult){
                complete();
            }else{
                [DKAlertHelper showMessage:@"We are so sorry. Event date not yet"];
            }
            if([[param objectForKey:@"authType"] isEqualToString:@"LIVENESS_TIMES"]){
                [DKPublicHttp apiUserBrhavRecordForAPI:@{@"result":[NSString stringWithFormat:@"%d",checkResult],@"authType":param.mj_JSONString} withPageName:DK_VerifyLiveness withAction:DK_ActionCheck complete:^{
                        
                } fail:^{
                        
                }];
            }else if ([[param objectForKey:@"authType"] isEqualToString:@"PAN_FRONT_TIMES"]){
                [DKPublicHttp apiUserBrhavRecordForAPI:@{@"result":[NSString stringWithFormat:@"%d",checkResult],@"authType":param.mj_JSONString} withPageName:DK_VerifyIdentify withAction:DK_ActionCheck complete:^{
                        
                } fail:^{
                        
                }];
            }
        }
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//活体策略配置
+(void)apiAuthLivenConfigForAPI:(NSDictionary *)param complete:(void(^)(DKAuthLivenConfigModel *dk_AuthLivenConfigMdl))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthLivenConfig] params:param withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        if([[data objectForKey:@"code"] isEqualToString:@"200"]){
            NSDictionary *nextStepDic = (NSDictionary *)[data objectForKey:@"data"];
            DKAuthLivenConfigModel *dk_AuthLivenConfigMdl = [DKAuthLivenConfigModel mj_objectWithKeyValues:nextStepDic];
            complete(dk_AuthLivenConfigMdl);
        }else{
            [DKAlertHelper showMessage:@"We are so sorry. Event date not yet"];
        }
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//活体识别
+(void)apiOssLiveBase64ForAPI:(NSDictionary *)param withData:(NSData *)imgData complete:(void(^)(DKAuthLiveBase64Model *dk_AuthLiveBase64Mdl))complete fail:(void(^)(NSString * msg))fail{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthOssLive] params:param withData:imgData withLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *nextStepDic = (NSDictionary *)[data objectForKey:@"data"];
        DKAuthLiveBase64Model *dk_AuthLivenConfigMdl = [DKAuthLiveBase64Model mj_objectWithKeyValues:nextStepDic];
        dk_AuthLivenConfigMdl.img = [NSString imageWithBase64String:dk_AuthLivenConfigMdl.url];
        complete(dk_AuthLivenConfigMdl);
    } failure:^(NSInteger status, NSString * _Nonnull msg) {
        fail(msg);
    }];
}
//活体预处理
+(void)apiPreLivenessForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthPreLive] params:param withJson:NO withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//保存用户信息
+(void)apiSaveUserInfoForAPI:(NSDictionary *)param complete:(void(^)(void))complete fail:(void(^)(void))fail{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthSaveUserInfo] params:param withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        fail();
    }];
}

//获取修改密码凭证信息
+(void)apiCheckPwdSmsCodeForAPI:(NSDictionary *)param complete:(void(^)(NSString *upPasswordCertificate))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_GetCheckUpPasswordSmsCode] params:param withJson:NO withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        if([[data objectForKey:@"code"] isEqualToString:@"200"]){
            NSString * upPasswordCertificate = (NSString *)[data objectForKey:@"data"];
            if(upPasswordCertificate.length){
                complete(upPasswordCertificate);
            }
        }
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//设置新密码
+(void)apiResetPwdForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_ResetPwd] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        if([[data objectForKey:@"code"] isEqualToString:@"200"]){
            complete();
        }
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//获取FAQ
+(void)apiGetFAQForAPI:(NSDictionary *)param complete:(void(^)(NSString *faq))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_GetCodeFaq] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        if([[data objectForKey:@"code"] isEqualToString:@"200"]){
            NSString * faq = (NSString *)[data objectForKey:@"data"];
            if(faq.length){
                NSDictionary * faqDic = faq.mj_JSONObject;
                if([faqDic allKeys].count > 0){
                    NSString *faqKey = [faqDic allKeys].firstObject;
                    NSString *faqValue = [faqDic objectForKey:faqKey];
                    complete(faqValue);
                }
            }
        }
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}

//获取产品列表
+(void)apiGetProductPackForAPI:(NSDictionary *)param complete:(void(^)(DKUserProductPackModel *userProductPackMdl))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_GetProductPack] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *userProductPackDic = (NSDictionary *)[data objectForKey:@"data"];
        DKUserProductPackModel *dk_UserProductPackMdl = [DKUserProductPackModel mj_objectWithKeyValues:userProductPackDic];
        complete(dk_UserProductPackMdl);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//检查用户放款状态
+(void)apiGetUserLoanStatusForAPI:(NSDictionary *)param complete:(void(^)(DKUserLoanStatusModel *userLoanStatusMdl))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_CheckUserLoanStatus] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *userLoanStatusDic = (NSDictionary *)[data objectForKey:@"data"];
        DKUserLoanStatusModel *userLoanStatusMdl = [DKUserLoanStatusModel mj_objectWithKeyValues:userLoanStatusDic];
        complete(userLoanStatusMdl);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}

//订单列表
+(void)apiGetOrderListForAPI:(NSDictionary *)param complete:(void(^)(DKOrderListModel *orderlist))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_OrderList] params:param withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *source = (NSDictionary *)[data objectForKey:@"data"];
        DKOrderListModel *orderlist= [DKOrderListModel mj_objectWithKeyValues:source];
        complete(orderlist);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        complete(nil);
    }];
}

//订单详情
+(void)apiGetOrderDetailAPI:(NSDictionary *)param complete:(void(^)(DKOrderDetailModel *orderlist))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_OrderDetail] params:param withJson:NO withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *source = (NSDictionary *)[data objectForKey:@"data"];
        DKOrderDetailModel *orderlist= [DKOrderDetailModel mj_objectWithKeyValues:source];
        complete(orderlist);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}

//还款详情
+(void)apiGetOrderRepayDetailAPI:(NSDictionary *)param complete:(void(^)(DKRepaymentDetailModel *orderlist))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_OrderRepaymentDetail] params:param withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *source = (NSDictionary *)[data objectForKey:@"data"];
        DKRepaymentDetailModel *orderlist= [DKRepaymentDetailModel mj_objectWithKeyValues:source];
        complete(orderlist);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}

//展期订单详情
+(void)apiGetOrderCalculateDetailAPI:(NSDictionary *)param complete:(void(^)(DKDelayFlexibleModel *orderlist))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_OrderCalculateDetail] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *source = (NSDictionary *)[data objectForKey:@"data"];
        DKDelayFlexibleModel *orderlist= [DKDelayFlexibleModel mj_objectWithKeyValues:source];
        complete(orderlist);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}

//获取还款图标
+(void)apiGetOrderBackImgAPI:(NSDictionary *)param complete:(void(^)(DKBankimagesModel *orderlist))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_OrderBankImages] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *source = (NSDictionary *)data;
        DKBankimagesModel *orderlist= [DKBankimagesModel mj_objectWithKeyValues:source];
        complete(orderlist);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}

//登出
+(void)apiLogoutUserForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_UserLoginOut] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//意见反馈
+(void)apiUserComplaintForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_UserComlaint] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//客服信息
+(void)apiCustomerServiceInfoForAPI:(NSDictionary *)param complete:(void(^)(DKCustomerServiceModel *customerServiceMdl))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_CustomerServiceInfo] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *dataDic = (NSDictionary *)[data objectForKey:@"data"];
        DKCustomerServiceModel *customerServiceMdl = [DKCustomerServiceModel mj_objectWithKeyValues:dataDic];
        complete(customerServiceMdl);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//FAQ标题列表
+(void)apiFaqGetTypeListForAPI:(NSDictionary *)param complete:(void(^)(NSArray *faqTitleMdls))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_FaqGetTypeList] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *userComplaintDic = (NSDictionary *)[data objectForKey:@"data"];
        NSArray *UserComplaintTitles = [userComplaintDic objectForKey:@"typeList"];
        NSArray *faqTitleMdls = [DKFaqTitleModel mj_objectArrayWithKeyValuesArray:UserComplaintTitles];
        complete(faqTitleMdls);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//FAQ标题下列表
+(void)apiGetFaqTypeListForAPI:(NSDictionary *)param complete:(void(^)(NSArray *faqUserMdls))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_FaqGetFaqList] params:param withJson:NO withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *userComplaintDic = (NSDictionary *)[data objectForKey:@"data"];
        NSArray *UserFaqs = [userComplaintDic objectForKey:@"faqList"];
        NSArray *faqUserMdls = [DKFaqTypeModel mj_objectArrayWithKeyValuesArray:UserFaqs];
        complete(faqUserMdls);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//FAQ意见反馈
+(void)apiFaqScoreForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_FaqFaqScore] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//FAQ模糊查询
+(void)apiGetQueryFaqListForAPI:(NSDictionary *)param complete:(void(^)(NSArray *faqUserMdls))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_FaqQueryFaq] params:param withJson:NO withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *userComplaintDic = (NSDictionary *)[data objectForKey:@"data"];
        NSArray *UserFaqs = [userComplaintDic objectForKey:@"faqList"];
        NSArray *faqUserMdls = [DKFaqTypeModel mj_objectArrayWithKeyValuesArray:UserFaqs];
        complete(faqUserMdls);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//获取银行卡列表
+(void)apiGetBankCardListForAPI:(NSDictionary *)param complete:(void(^)(NSArray *bankCardMdls))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthBanCardList] params:param withJson:NO withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSArray *bankCardLists = [data objectForKey:@"data"];
        NSArray *bankCardMdls = [DKBankCardModel mj_objectArrayWithKeyValuesArray:bankCardLists];
        complete(bankCardMdls);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//认证
//获取所有步骤的奖励金钱
+(void)apiGetAwardAmountForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthGetAwardAmount] params:param withJson:NO withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        NSArray *commons = [data objectForKey:@"data"];
        [DKGlobalHelper defaultManager].authAwardAmountMdls = [DKAuthAwardAmountModel mj_objectArrayWithKeyValuesArray:commons];
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//基础信息对应的下拉列表
+(void)apiGetCommonDictListForAPI:(NSDictionary *)param complete:(void(^)(NSArray *commonDictMdls))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthCommon] params:param withJson:NO withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *commonDic = (NSDictionary *)[data objectForKey:@"data"];
        NSArray *commonDics = [commonDic objectForKey:@"dictList"];
        NSArray *commonDictMdls = [DKAuthCommonDicModel mj_objectArrayWithKeyValuesArray:commonDics];
        complete(commonDictMdls);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//银行卡正面认证
+(void)apiGetCommonPanPositiveForAPI:(NSDictionary *)param withData:(NSData *)imgData complete:(void(^)(DKAuthPanCardModel *dk_AuthPanCardMdl))complete fail:(void(^)(NSString * msg))fail{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthCommonUploadPanPositive] params:param withData:imgData success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *authPanCardDic = (NSDictionary *)[data objectForKey:@"data"];
        DKAuthPanCardModel *dk_AuthPanCardMdl = [DKAuthPanCardModel mj_objectWithKeyValues:authPanCardDic];
        complete(dk_AuthPanCardMdl);
        
        NSString *name = dk_AuthPanCardMdl.idCardOcrDetails.name;
        if(!name.length){
            name = @"";
        }
        NSString *idNumber = dk_AuthPanCardMdl.idCardOcrDetails.idNumber;
        if(!idNumber.length){
            idNumber = @"";
        }
        [DKPublicHttp apiUserBrhavRecordForAPI:@{@"name":name,@"panNo":idNumber,@"isSuccess":@"1"} withPageName:DK_VerifyIdentify withAction:DK_ActionID_Pan_Front_Result complete:^{
                
        } fail:^{
                
        }];
    } failure:^(NSInteger status, NSString * _Nonnull msg) {
        fail(msg);
        [DKPublicHttp apiUserBrhavRecordForAPI:@{@"isSuccess":@"0"} withPageName:DK_VerifyIdentify withAction:DK_ActionID_Pan_Front_Result complete:^{
                
        } fail:^{
                
        }];
    }];
}
//获取银行列表
+(void)apiGetBankListForAPI:(NSDictionary *)param complete:(void(^)(NSArray *bankMdls))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthGetBankList] params:param withJson:NO withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        NSArray *bankMdls = [data objectForKey:@"data"];
        complete(bankMdls);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}

//设置密码
+(void)apiUserSetPwdForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_UserSetPwd] params:param withJson:NO withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//总借款信息
+(void)apiTotalLoanInfoForAPI:(NSDictionary *)param complete:(void(^)(DKLoanDetailModel *dk_LoanDetailMdl))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_TotalLoanInfo] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *loanDetailPairsDic = (NSDictionary *)[data objectForKey:@"data"];
        DKLoanDetailModel *dk_LoanDetailMdl = [DKLoanDetailModel mj_objectWithKeyValues:loanDetailPairsDic];
        complete(dk_LoanDetailMdl);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//申请借款
+(void)apiLoanApplyForAPI:(NSDictionary *)param complete:(void(^)(BOOL isScore))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_LoanApply] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        //打点
        [[DKAdjustHelper defaultManager] adjustUserLoan];
        complete([[NSString stringWithFormat:@"%@",[data objectForKey:@"data"]] boolValue]);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//用户提交评分
+(void)apiUserSubmitRateForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_UserSubmitRate] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//获取订单状态
+(void)apiOrderStateForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_OrderState] params:param withJson:YES withIsLoad:YES success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *loanDetailPairsDic = (NSDictionary *)[data objectForKey:@"data"];
        [DKGlobalHelper defaultManager].orderStatusMdl = [DKOrderStatusModel mj_objectWithKeyValues:loanDetailPairsDic];
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}

//检查用户扩展信息是否过期
+(void)apiCheckExtExpiredForAPI:(NSDictionary *)param complete:(void(^)(DKExtExpiredModel *extExpiredMdl))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthCheckExtExpired] params:param withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        NSDictionary *extExpiredDic = (NSDictionary *)[data objectForKey:@"data"];
        DKExtExpiredModel *extExpiredMdl = [DKExtExpiredModel mj_objectWithKeyValues:extExpiredDic];
        complete(extExpiredMdl);
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//扩展信息上传
+(void)apiAuthExtInfoForAPI:(NSDictionary *)param complete:(void(^)(void))complete{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_AuthExtInfo] params:param withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        
    }];
}
//修改银行卡
+(void)apiModifyBankCardForAPI:(NSDictionary *)param complete:(void(^)(void))complete fail:(void(^)(void))fail{
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_Modifybankcard] params:param withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        fail();
    }];
}
//行为数据上传
+(void)apiUserBrhavRecordForAPI:(NSDictionary *)param withPageName:(NSString *)pageName withAction:(NSString *)action complete:(void(^)(void))complete fail:(void(^)(void))fail{
    NSString * url = [NSString stringWithFormat:@"%@%@/%@",DK_UserBrhavRecord,pageName,action];
    NSMutableDictionary * brhavRecordDic = [[NSMutableDictionary alloc] init];
    if([Adjust adid].length){
        [brhavRecordDic setObject:[Adjust adid] forKey:@"adid"];
    }
    [brhavRecordDic setObject:[DKGlobalHelper defaultManager].userRandomKey forKey:@"userRandomKey"];
    if(param.allKeys.count > 0){
        [brhavRecordDic setObject:param.mj_JSONString forKey:@"extInfo"];
    }else{
        [brhavRecordDic setObject:@"" forKey:@"extInfo"];
    }
    [[DKHttpHelper request] POST:[NSString getServiceUrl:url] params:brhavRecordDic withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        fail();
    }];
}
//风控埋点
+(void)apiUserRiskForAPI:(NSString *)sceneType complete:(void(^)(void))complete fail:(void(^)(void))fail{
    NSMutableDictionary * brhavRecordDic = [[NSMutableDictionary alloc] init];
//    [brhavRecordDic setObject:[Adjust adid] forKey:@"adid"];
    if([Adjust adid].length){
        [brhavRecordDic setObject:[Adjust adid] forKey:@"adid"];
    }
    [brhavRecordDic setObject:[DKGlobalHelper defaultManager].selfUuid forKey:@"deviceNo"];
    [brhavRecordDic setObject:[DKGlobalHelper defaultManager].userRandomKey forKey:@"userRandomKey"];
    if([DKGlobalHelper defaultManager].dk_LocationMdl.latitude.length){
        [brhavRecordDic setObject:[DKGlobalHelper defaultManager].dk_LocationMdl.latitude forKey:@"latitude"];
    }else{
        [brhavRecordDic setObject:@"" forKey:@"latitude"];
    }
    if([DKGlobalHelper defaultManager].dk_LocationMdl.longitude.length){
        [brhavRecordDic setObject:[DKGlobalHelper defaultManager].dk_LocationMdl.longitude forKey:@"longitude"];
    }else{
        [brhavRecordDic setObject:@"" forKey:@"longitude"];
    }
    [brhavRecordDic setObject:sceneType forKey:@"sceneType"];
    [brhavRecordDic setObject:[NSString getCurrentTimeTimestamp] forKey:@"endTime"];
    if([sceneType isEqualToString:@"REGISTERED"]){
        if([DKGlobalHelper defaultManager].registeredStartTime){
            [brhavRecordDic setObject:[DKGlobalHelper defaultManager].registeredStartTime forKey:@"startTime"];
        }else{
            [brhavRecordDic setObject:@"" forKey:@"startTime"];
        }
    }else if ([sceneType isEqualToString:@"LIVENESS"]){
        if([DKGlobalHelper defaultManager].livenessStartTime){
            [brhavRecordDic setObject:[DKGlobalHelper defaultManager].livenessStartTime forKey:@"startTime"];
        }else{
            [brhavRecordDic setObject:@"" forKey:@"startTime"];
        }
    }else if ([sceneType isEqualToString:@"PAN_CARD_FRONT"]){
        if([DKGlobalHelper defaultManager].panCardStartTime){
            [brhavRecordDic setObject:[DKGlobalHelper defaultManager].panCardStartTime forKey:@"startTime"];
        }else{
            [brhavRecordDic setObject:@"" forKey:@"startTime"];
        }
    }else if ([sceneType isEqualToString:@"INFORMATION"]){
        if([DKGlobalHelper defaultManager].infoStartTime){
            [brhavRecordDic setObject:[DKGlobalHelper defaultManager].infoStartTime forKey:@"startTime"];
        }else{
            [brhavRecordDic setObject:@"" forKey:@"startTime"];
        }
    }else if ([sceneType isEqualToString:@"CONTACT"]){
        if([DKGlobalHelper defaultManager].contactStartTime){
            [brhavRecordDic setObject:[DKGlobalHelper defaultManager].contactStartTime forKey:@"startTime"];
        }else{
            [brhavRecordDic setObject:@"" forKey:@"startTime"];
        }
    }else if ([sceneType isEqualToString:@"BANK"]){
        if([DKGlobalHelper defaultManager].bankStartTime){
            [brhavRecordDic setObject:[DKGlobalHelper defaultManager].bankStartTime forKey:@"startTime"];
        }else{
            [brhavRecordDic setObject:@"" forKey:@"startTime"];
        }
    }
    [[DKHttpHelper request] POST:[NSString getServiceUrl:DK_UserAddRiskControlTracking] params:brhavRecordDic withJson:YES withIsLoad:NO success:^(NSInteger status, id  _Nonnull data) {
        complete();
    }failure:^(NSInteger status, NSString * _Nonnull msg) {
        fail();
    }];
}
@end
